<?PHP
  $current_page = "event_edit.php";
  $page_type = "S";
  require_once 'header.php';
?>
	<div id="page">
	  <div id="page-padding">
        <!-- start content -->	    
	    <div id="content">
	      <div id="content-padding">
            <h1>Edit Event</h1>
            <p>
			<?PHP
			
				
				$old_eid = $_GET['eid'];
				$old_uid = $_GET['uid'];
				
				$whereclause = "1=1";
				
				if (isset($old_eid) and trim($old_eid) != "")
					$whereclause .= " and eventid = '$old_eid'";
				if (isset($old_uid) and trim($old_uid) != "")
					$whereclause .= " and userid = '$old_uid'";
					
				//Query the selected Event
				$sql = "select UserID, EventID, Ename, Post_Date, LCName, Street, City, State, Zip, S_Time, E_Time, Description " .
					" from EVENT where $whereclause";
				$result_array = execute_sql_in_oracle($sql);
				$result = $result_array["flag"];
				$cursor = $result_array["cursor"];
				if (!$result){
					display_oracle_error_message($cursor);
					die("Query for edit failed.");
				}
				$values = oci_fetch_array($cursor);
				oci_free_statement($cursor);
				
				$userid = $values[0];
				$eventid = $values[1];
				$eventname = $values[2];
				$postdate = $values[3];
				$locationname = $values[4];
				$street = $values[5];
				$city = $values[6];
				$state = $values[7];
				$zip = $values[8];
				$starttime = $values[9];
				$endtime = $values[10];
				$description = $values[11];
				
				echo("
				<form method=\"post\" action=\"event_edit_response.php\">
				User ID (Read-only): <input type=\"text\" readonly value = \"$userid\" size=\"20\" maxlength=\"30\" name=\"userid\"> <br> 
				Event ID (Read-only): <input type=\"text\" readonly value = \"$eventid\" size=\"20\" maxlength=\"8\" name=\"eventid\">  <br>
				Event Name: <input type=\"text\" value = \"$eventname\" size=\"20\" maxlength=\"50\" name=\"eventname\">  <br>
				Post Date (DD-MON-YY): <input type=\"datetime\" value = \"$postdate\" size=\"20\" maxlength=\"30\" name=\"postdate\">  <br>
				Location Name: <input type=\"text\" value =\"$locationname\" size=\"20\" maxlength=\"50\" name=\"locationname\"><br> 
				Street: <input type=\"text\" value =\"$street\" size=\"20\" maxlength=\"50\" name=\"street\"><br>
				City: <input type=\"text\" value =\"$city\" size=\"20\" maxlength=\"50\" name=\"city\"><br>
				State: <input type=\"text\" value =\"$state\" size=\"20\" maxlength=\"50\" name=\"state\"><br>
				Zip: <input type=\"text\" value =\"$zip\" size=\"20\" maxlength=\"12\" name=\"zip\"><br>
				Start Time: <input type=\"datetime\" value =\"$starttime\" size=\"20\" maxlength=\"50\" name=\"starttime\"><br>
				End Time: <input type=\"datetime\" value =\"$endtime\" size=\"20\" maxlength=\"15\" name=\"endtime\"><br>
				Description: <input type=\"text\" value\"$description\" size=\"50\" maxlength=\"500\" name=\"description\"><br>
				<input type=\"submit\" value=\"Submit\">");
				
			
			
			?>
			</p>
	      </div>
		</div>
	  <!-- end content --></div>
	  <div id="footer">
	    <div id="footer-pad">
	      <div class="line"></div>
		  <!-- footer and copyright notice -->
	      <p>Design by <a href="http://www.steves-templates.com">Steve's free website templates</a>.</p>
		  <!-- end footer and copyright notice -->
	    </div>
	  </div>
	</div>
  </body>
</html>